{layout name="common/basic" /}

<script>
    function showHint(str) {


        var xmlhttp;
        if (str.length == 0) {
            document.getElementById("txtHint").innerHTML = "请输入手机号";
            return;
        }

        if (str.length != 11) {
            document.getElementById("txtHint").innerHTML = "手机号格式有误";
            return;
        }

        // var phone = str.length;
        //   if(!(/^1[34578]\d{9}$/.test(phone))){
        //       document.getElementById("txtHint").innerHTML="手机号格式有误";
        //       return false;
        //   }
        if (window.XMLHttpRequest) {
            // IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
            xmlhttp = new XMLHttpRequest();
        } else {
            // IE6, IE5 浏览器执行代码
            xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xmlhttp.onreadystatechange = function () {
            if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                document.getElementById("txtHint").innerHTML = '开始读取数据';
                document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
            }
            if (xmlhttp.status > 200) {

                document.getElementById("txtHint").innerHTML = "请稍后再试 错误：" + xmlhttp.readyState + "状态" + xmlhttp.status;

            }
        }
        xmlhttp.open("POST", "{$Think.server.script_name}/index/api/sms/s/" + str, true);
        xmlhttp.send();
        showtime(120);
    }
</script>

<script type="text/javascript">

    function showtime(t) {
        document.getElementById("sms").disabled = true;
        for (i = 1; i <= t; i++) {
            window.setTimeout("update_p(" + i + "," + t + ")", i * 1000);
        }

    }

    function update_p(num, t) {
        if (num == t) {
            document.getElementById("sms").innerHTML = "重新发送";
            document.getElementById("sms").disabled = false;
        } else {
            printnr = t - num;
            document.getElementById("sms").innerHTML = " (" + printnr + ")s";
        }
    }
</script>


<div class="row">
    <div class="col-md-6">
        <div class="card card-primary">
            <div class="card-header">
                <h3 class="card-title">账号密码</h3>
            </div>
            <!-- /.card-header -->
            <!-- form start -->
            <form role="form" method="post" action="{:url('index/index/login')}">
                <div class="card-body">
                    <div class="form-group">
                        <label>手机号</label>
                        <input type="text" id="tel182" name="phone" class="form-control" placeholder="输入已注册手机号">
                    </div>

                    <div class="form-group">
                        <label>密码</label>
                        <input type="password" name="password" class="form-control" placeholder="输入密码">
                    </div>


                </div>
                <!-- /.card-body -->

                <div class="card-footer">
                    <button type="submit" class="btn btn-primary">提交</button>
                    <a href="{:url('index/index/password')}">找回密码</a>
                    <span style="color: orangered;padding-left: 5px">{$login_warning}</span>
                </div>

            </form>
        </div>
    </div>

    <div class="col-md-6">
        <div class="card card-warning">
            <div class="card-header">
                <h3 class="card-title">短信登录</h3>
            </div>
            <!-- /.card-header -->
            <!-- form start -->
            <form role="form" method="post" action="{:url('index/index/smslogin')}">
                <div class="card-body">
                    <div class="form-group">
                        <label>手机号</label>
                        <input type="text" id="tel1821" name="phone" class="form-control" placeholder="输入已注册手机号">
                    </div>
                    <label>验证码</label>
                    <div class="input-group mb-3">
                        <input type="text" class="form-control" name="rand" placeholder="请输入验证码">
                        <div class="input-group-append">
                    <span class="input-group-text" id="sms"
                          onclick="showHint(document.getElementById('tel1821').value)">
                        <i class="fas fa-envelope" style="padding-right: 5px"></i>获取验证码</span>
                        </div>
                    </div>


                </div>
                <!-- /.card-body -->

                <div class="card-footer">
                    <button type="submit" class="btn btn-primary">提交</button>
                    <span id="txtHint" style="color: orangered;padding-left: 5px">{$warning}</span>
                </div>

            </form>
        </div>
    </div>

</div>

<div class="alert alert-secondary" role="alert">
    <h4>使用第三方账号登录</h4>
    <a href="https://graph.qq.com/oauth2.0/authorize?response_type=code&client_id=100556678&redirect_uri=http://open.gaoxueya.com/index/api/qq&scope=get_user_info"
       target="_blank">
        <img src="__STATIC__/images/ico_login_qq.png" title="使用QQ帐号登录"></a>
    <a href="https://api.weibo.com/oauth2/authorize?client_id=1460932055&response_type=code&redirect_uri=http://open.gaoxueya.com/index/api/weibo"
       target="_blank" style="padding:16px">
        <img src="__STATIC__/images/ico_login_32_32_weibo.png" title="使用微博帐号登录"></a>

    <a href="https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx45d07510895e9970&redirect_uri=http%3a%2f%2fopen.gaoxueya.com%2findex%2fapi%2fwechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect">微信登录</a>


</div>

<div class="card">
    <div class="card-header">
        短信接口
    </div>
    <div class="card-body">
        <h5 class="card-title">福利~ 使用本站短信接口，领取50条免费短信</h5>
        <p class="card-text">注册邀请双方都可以获得50条免费短信条数</p>
        <a href="https://s1.chanyoo.net/register?invite=guomengtao1" target="_blank" class="btn btn-primary">立即领取</a>
    </div>
</div>